import request from "@/utils/request";
import { Favorite, FavoriteListResponse } from "@/types/favorite";

// 获取收藏列表
export const getFavoriteList = () => {
  return request.post<FavoriteListResponse>("/api/client/favorite/list");
};

// 获取收藏状态
export const getFavoriteStatus = (contentId: string) => {
  return request.post<{ isFavorited: boolean }>(
    `/api/client/contents/favorite-status`,
    { contentId }
  );
};

// 切换收藏状态
export const toggleFavorite = (contentId: string) => {
  return request.post("/api/client/contents/toggle-favorite", { contentId });
};

// 为了语义清晰，保留 create 和 delete，但它们都调用 toggle
export const createFavorite = toggleFavorite;
export const deleteFavorite = toggleFavorite;